package com.edu.zql;

/**
 * Created by User on 2018/1/2.
 */
public class 位操作反转 {
    public static void main(String[] args) {
        int a = 0XBB0D8196;
        String string = Integer.toHexString(a);
        System.out.println(string);

        int reverse = reverse(a);
        System.out.println(Integer.toHexString(reverse));

    }

    private static int reverse(int a) {
        int j = (1 << 8) - 1;
        int i = a & j;
        int ii = a & j << 8;
        int iii = a & j << 16;
        int iiii = a & j << 24;
        return i << 24 | ii << 8 | iii >>> 8 | iiii >>> 24;
    }

}
